package ae.pcfc.etks.online.itworx.ehs.web.entity;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;

import org.hibernate.annotations.ForeignKey;

import ae.pcfc.etks.online.itworx.ehs.web.enums.RequestStatus;
import ae.pcfc.etks.online.itworx.ehs.web.enums.RequestType;
import ae.pcfc.etks.online.itworx.ehs.web.enums.UserType;

@Entity
@Table(name = "T_EHS_REQUEST")
@Inheritance(strategy = InheritanceType.JOINED)
@XmlRootElement(name = "request")
@XmlAccessorType(XmlAccessType.FIELD)
@SequenceGenerator(name = "EHS_REQUEST_ID_SEQ", sequenceName = "EHS_REQUEST_ID_SEQ", initialValue = 1, allocationSize = 1)
public class Request  extends AuditableEntity implements Serializable {

	@Id
	@Column(name = "EHS_REQUEST_ID")
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "EHS_REQUEST_ID_SEQ")
	@XmlElement
	private long id;
	@Column(name = "PROCESS_ID", nullable = false, length = 50)
	@XmlElement
	private String processId;
	@Column(name = "USER_ID", nullable = false, length = 50)
	@XmlElement
	private String userId;
	@Column(name = "OFFICER_ID", length = 50)
	@XmlElement
	private String officerId;
	@Column(name = "STATUS", nullable = false, length = 50)
	@Enumerated(EnumType.STRING)
	@XmlElement
	private RequestStatus status;
	@Column(name = "EXECUTER", nullable = false, length = 50)
	@Enumerated(EnumType.STRING)
	@XmlElement
	private UserType executer;
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "CREATION_DATE", nullable = false)
	@XmlElement
	private Date creationDate;
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "PROCESSING_DATE", nullable = false)
	@XmlElement
	private Date processingDate;
	@Column(name = "COMPANY_NAME_AR")
	@XmlElement
	private String companyNameArabic;
	@Column(name = "COMPANY_NAME_EN")
	@XmlElement
	private String companyNameEnglish;
	@Column(name = "TYPE", nullable = false, length = 50)
	@Enumerated(EnumType.STRING)
	private RequestType type;
	@OneToOne
	@ForeignKey(name = "FK_REQUEST_SERVICE", inverseName = "FK_SERVICE_REQUEST")
	@JoinColumn(name = "EHS_SERVICE_ID")
	private Service service;
	@Column(name = "TRAKHEES_ID", length = 50)
	@XmlElement
	private String trakheesId;

	public String getCompanyNameEnglish() {
		return companyNameEnglish;
	}

	public void setCompanyNameEnglish(String companyNameEnglish) {
		this.companyNameEnglish = companyNameEnglish;
	}

	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public String getProcessId() {
		return processId;
	}

	public void setProcessId(String processId) {
		this.processId = processId;
	}

	public String getUserId() {
		return userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}

	public String getOfficerId() {
		return officerId;
	}

	public void setOfficerId(String officerId) {
		this.officerId = officerId;
	}

	public RequestStatus getStatus() {
		return status;
	}

	public void setStatus(RequestStatus status) {
		this.status = status;
	}

	public UserType getExecuter() {
		return executer;
	}

	public void setExecuter(UserType executer) {
		this.executer = executer;
	}

	public Date getCreationDate() {
		return creationDate;
	}

	public void setCreationDate(Date creationDate) {
		this.creationDate = creationDate;
	}

	public Date getProcessingDate() {
		return processingDate;
	}

	public void setProcessingDate(Date processingDate) {
		this.processingDate = processingDate;
	}

	public String getCompanyNameArabic() {
		return companyNameArabic;
	}

	public void setCompanyNameArabic(String companyNameArabic) {
		this.companyNameArabic = companyNameArabic;
	}

	public Service getService() {
		return service;
	}

	public void setService(Service service) {
		this.service = service;
	}

	public RequestType getType() {
		return type;
	}

	public void setType(RequestType type) {
		this.type = type;
	}

	public String getTrakheesId() {
		return trakheesId;
	}

	public void setTrakheesId(String trakheesId) {
		this.trakheesId = trakheesId;
	}
}
